package com.jic.member.impl;

import java.lang.Long;
import java.util.List;

import com.jic.common.base.vo.Page;
import com.jic.common.base.vo.PageResult;
import com.jic.member.entity.MememberLegalRuleLogistics;
import com.jic.member.mapper.MememberLegalRuleLogisticsMapper;
import com.jic.member.service.MememberLegalRuleLogisticsService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 会员等级管理-权益规则-物流权益表
 * @author : 
 * @email : 
 * @since : 2020-04-02 07:52:17
 * @version : v1.0.0
 */
@Service
public class MememberLegalRuleLogisticsServiceImpl implements MememberLegalRuleLogisticsService{

    @Autowired
    private MememberLegalRuleLogisticsMapper mememberLegalRuleLogisticsMapper;

    @Override
    public long insert(MememberLegalRuleLogistics mememberLegalRuleLogistics) {
        long flag = mememberLegalRuleLogisticsMapper.insert(mememberLegalRuleLogistics);
        return flag;
    }

    @Override
    public long delete(Long id) {
        return mememberLegalRuleLogisticsMapper.delete(id);
    }

    @Override
    public long update(MememberLegalRuleLogistics mememberLegalRuleLogistics) {
        return mememberLegalRuleLogisticsMapper.update(mememberLegalRuleLogistics);
    }

    @Override
    public MememberLegalRuleLogistics queryByPrimaryKey(Long id){
        return mememberLegalRuleLogisticsMapper.queryByPrimaryKey(id);
    }

    @Override
    public List<MememberLegalRuleLogistics> query(MememberLegalRuleLogistics mememberLegalRuleLogistics){
        return mememberLegalRuleLogisticsMapper.query(mememberLegalRuleLogistics);
    }

    @Override
    public PageResult<MememberLegalRuleLogistics> queryPage(MememberLegalRuleLogistics mememberLegalRuleLogistics, Page pageQuery) {
        //计算下标
        int startIndex = (pageQuery.getStart() - 1) * pageQuery.getLimit();
        List<MememberLegalRuleLogistics> list = mememberLegalRuleLogisticsMapper.queryPage(startIndex, pageQuery.getLimit(), mememberLegalRuleLogistics);
        long count = mememberLegalRuleLogisticsMapper.queryPageCount(mememberLegalRuleLogistics);
        PageResult pageResult = new PageResult();
        pageResult.setRows(list);
        pageResult.setTotal(count);
        return pageResult;
    }
}